﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace CardFormatter
{
    public class Answer
    {
        private string dotType;
        public string DotType
        {
            get
            {
                return dotType;
            }
            set
            {
                dotType = value;
            }
        }
    }
    public class MinorType
    {
        private string dotType;
        public string DotType
        {
            get
            {
                return dotType;
            }
            set
            {
                dotType = value;
            }
        }
    }
    public class Identifier
    {
        private string dotType;
        public string DotType
        {
            get
            {
                return dotType;
            }
            set
            {
                dotType = value;
            }
        }

    }
    public class MajorType
    {
        private string dotType;
        public string DotType
        {
            get
            {
                return dotType;
            }
            set
            {
                dotType = value;
            }
        }

    }
    public class CardType
    {
        private string dotType;
        public string DotType
        {
            get
            {
                return dotType;
            }
            set
            {
                dotType = value;
            }
        }

    }
    public class BlankDot
    {
        private bool is_Answer, is_MinorType, is_Identifier, is_MajorType,is_Empty;
        public void InitDot()
        {
            is_Empty = true;
        }
        public int DotCategory
        {
            get
            {               
                if (is_Answer)
                {
                    return 0;
                }
                else if (is_MinorType)
                {
                    return 1;
                }
                else if (is_Identifier)
                {
                    return 2;
                }
                else if (is_MajorType)
                {
                    return 3;
                }
                else
                {
                    return 4;
                }
            }
            set
            {
                if(value == 0)
                {
                    is_Answer = true;
                    is_MinorType = false;
                    is_Identifier = false;
                    is_MajorType = false;
                    is_Empty = false;
                }
                else if (value == 1)
                {
                    is_Answer = false;
                    is_MinorType = true;
                    is_Identifier = false;
                    is_MajorType = false;
                    is_Empty = false;
                }
                else if (value == 2)
                {
                    is_Answer = false;
                    is_MinorType = false;
                    is_Identifier = true;
                    is_MajorType = false;
                    is_Empty = false;
                }
                else if (value == 3)
                {
                    is_Answer = false;
                    is_MinorType = false;
                    is_Identifier = false;
                    is_MajorType = true;
                    is_Empty = false;
                }
                else
                {
                    is_Answer = false;
                    is_MinorType = false;
                    is_Identifier = false;
                    is_MajorType = false;
                    is_Empty = true;
                }
            }
        }
        
    }
    public class AbstractMapping
    {
        private static int width;
        private static int height;
       
        BlankDot[,] abstractMap;
        public void SetWidth(int Width)
        {
            width = Width;
        }
        public void SetHeight(int Height)
        {
            height = Height;
        }
        public void InitMap()
        {
            abstractMap = new BlankDot[width, height];
        }
        public void SetMap(int[,] Map)
        {
            
            for(int i = 0; i < Map.GetLength(1);i++)
            {
                for(int v = 0; v < Map.GetLength(0); v++)
                {
                    BlankDot blkDot = new BlankDot()
                    {
                        DotCategory = Map[v, i]
                    };                  
                    abstractMap[v, i] = blkDot;
                }
            }
        }
        public BlankDot[,] GetMap()
        {
            return abstractMap;
        }
    }
    public class PointDef
    {
        private string type;
        private string value;
        public void SetPoint(List<string> iList)
        {
            type = iList[0];
            value = iList[1];
        }
        public List<string> GetPoint()
        {
            List<string> iList = new List<string>();
            iList.Add(type);
            iList.Add(value);
            return iList;
        }
    }
    
    static class Program
    {
        /// <summary>
        /// 应用程序的主入口点。
        /// </summary>
        [STAThread]
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new MainForm());
        }
    }
}
